$.ajaxPrefilter(function (option) {
    // console.log(option);
    //判断是否需要权限
    //startWith是否以某个字符开头
    if (option.url.startsWith('/my')) {
        option.headers = {
            Authorization: localStorage.getItem('token') || ''
        }
    }
    option.url = 'http://api-breakingnews-web.itheima.net' + option.url;
  
    option.complete = function (res) {
        if (res.responseJSON.status === 1 && res.responseJSON.message == '身份认证失败！') {
            localStorage.removeItem('token')
            location.href='/login.html'
        }
    }
})